




import characterTools from "shared/component/common/characterTools";


import { AIClient, aninmClient, characterStateClient, effectClient, move2DClient, physical2DClient, SkillClient } from "./clientLib";
/* npc 模型添加 */
AIClient?.onNpcCharacterAdd((AIEntity) => {
    const character = AIEntity.character;
    if (!character) throw (character + ' is not Model')
    while (!character.FindFirstChild("HumanoidRootPart")) {
        print('wait characermodel loading...')
        task.wait(1)
    }
    physical2DClient.constraint(character.HumanoidRootPart, characterTools.getRootAttName())//绑定2D物理
    characterStateClient.addCharacter(AIEntity)//监听角色状态
    SkillClient.addCharacter(character)
    aninmClient.addCharacter(AIEntity);//添加角色动画
    move2DClient.addCharacter({
        humanModel: character,
    })//绑定角色运动控制
    effectClient.addCharacter(AIEntity)
})
AIClient?.onAIcommandCall((command) => {
    move2DClient.act(command.act, command.character)
})
